package com.jida.tijian.service;

import com.jida.tijian.dto.ResponseObject;
import com.jida.tijian.mapper.HospitalMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

//Impl一定要带帽子
@Service
public class HospitalServiceImpl implements HospitalService {

    //1.因为要对数据库操作所以要使用对应的Mapper
    @Autowired
    HospitalMapper hospitalMapper;

    //这是具体的业务代码 获取医院列表的方法
    @Override
    public ResponseObject listHospital() {
//        返回一个给前端的具体对象
        return new ResponseObject<>(
                ResponseObject.SUCCESS_STATUS,
                ResponseObject.SUCCESS_DESC,
//              调用数据库的selectAll方法
                hospitalMapper.selectAll()

        );
    }
}
